<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use doumiaoduo\buildform\BuildFormElement;
use zhtfrontend\assets\AppAsset;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <?= Html::csrfMetaTags() ?>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height">
    <div id="form_create" class="zx-mg">
        <?php $form = ActiveForm::begin(['id' => $form_config['id'],'enableClientValidation'=>$form_config['enableClientValidation'],'enableAjaxValidation'=>$form_config['enableAjaxValidation'],'options'=>$form_config['options']]);?>
        <input type="hidden" name="type" id="type" value="<?=$type?>" />

        <ul class="nav nav-tabs yx-nav-tabs1" id="myTab">
            <?php $element_num=count($form_config['models'])?>
            <?php $n=1;?>
            <?php foreach($form_config['models'] as $k=>$element){ ?>
                <li id="form_menu_<?=$n?>" onclick="formTypeTab('form_menu','<?=$element_num?>','<?=$n?>')" class=<?=(isset($type)&&$k==$type)?"form_menu_on":"form_menu_off"?> rel="<?=$k?>"><?=$element['title']?></li>
                <?php $n++;?>
            <?php } ?>
        </ul>

        <?php $m=1;?>
        <?php foreach ($form_config['models'] as $k => $v) { ?>

            <div class="form_content" id="form_menu_content_<?=$m;?>" <?=((isset($type)&&$k==$type)?'':'style="display:none"');?>>
                <table width="100%" class="table_form">
                    <tbody>
                    <?php foreach ($v['elements'] as $ek => $e) { ?>
                        <tr>
                            <th width="<?= $v['th_with']?>px" style="<?=$v['style']?>"><?=BuildFormElement::label($form_config, $k, $ek); ?></th>
                            <td><?= BuildFormElement::field($form, $form_config, $k, $ek); ?></td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
            <?php $m++; } ?>

        <?=Html::submitInput('提交', ['id' => 'dosubmit','class'=>'btn yx-save yx-tijiao yx-radius50 yx-ml165']) ?>
        <?php ActiveForm::end(); ?>
    </div>
</div>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

